import 'package:flutter/material.dart';
import 'package:flutter_eve_plugin/components/health/main_header_desc.dart';
import 'package:flutter_eve_plugin/components/health/main_header_stack.dart';
import 'package:flutter_eve_plugin/store/main.dart';
import 'package:flutter_eve_plugin/store_vm/app_vm.dart';
import 'package:flutter_eve_plugin/utils/image_util.dart';
import 'package:flutter_eve_plugin/utils/screen_util.dart';
import 'package:flutter_redux/flutter_redux.dart';

class HealthMainHeaderWidget extends StatelessWidget {
  const HealthMainHeaderWidget({
    Key key,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return StoreConnector<AppState, AppStateViewModel>(
        converter: (store) => AppStateViewModel(state: store.state),
        builder: (context, vm) {
          return SliverToBoxAdapter(
              child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            crossAxisAlignment: CrossAxisAlignment.start,
            children: <Widget>[
              Container(
                  height: setRatio(278),
                  width: setRatio(357),
                  margin: EdgeInsets.only(
                      left: setRatio(9),
                      right: setRatio(9),
                      top: setRatio(40),
                      bottom: setRatio(13)),
                  decoration: BoxDecoration(
                    image: DecorationImage(
                      image: AssetImage(imageUtilHuPo('health/icon_health_main_header_bg@2x')),
                      alignment: Alignment.topCenter,
                      fit: BoxFit.cover,
                    ),
                  ),
                  child: MainHeaderStackWidget()),
              MainHeaderDescWidget(),
              Container(
                width: setRatio(375),
                height: setRatio(7),
                color: Color(0xFFF5F5F5),
              )
            ],
          ));
        });
  }
}
